/*
 * @Author: Larry
 * @Date:   2016-12-15 17:20:54
 * @Last Modified by:   qinsh
 * @Last Modified time: 2016-12-24 21:51:17
 * +----------------------------------------------------------------------
 * | LarryBlogCMS [ LarryCMS网站内容管理系统 ]
 * | Copyright (c) 2016-2017 http://www.larrycms.com All rights reserved.
 * | Licensed ( http://www.larrycms.com/licenses/ )
 * | Author: qinshouwei <313492783@qq.com>
 * +----------------------------------------------------------------------
 */
'use strict';
layui.use(['jquery'], function () {
    window.jQuery = window.$ = layui.jquery;
    $(".layui-canvs").width($(window).width());
    $(".layui-canvs").height($(window).height());
    $('.submit_btn').click(function () {
        var name = $('#name').val();
        var pwd = $('#pwd').val();
        var captcha = $('#captcha').val();
        if (name.length < 1) {

            layer.tips('请输入用户名', '#name');
            return;
        }

        if (pwd.length < 1) {
            layer.tips('请输入密码', '#pwd');
            return;
        }
        if (captcha.length < 1) {
            layer.tips('请输入验证码', '#captcha');
            return;
        }
        var url = postUrl;
        $.post(url, {name: name, pwd: pwd, captcha: captcha}, function (data) {
            if (data.status) {
                $('#code_img').click();
                layer.msg(data.msg);
            } else {
                window.location.href = indexUrl;
            }
        })
    })
});
